package com.example.online.music.controller;

import com.example.online.music.common.R;
import com.example.online.music.model.request.UserSupportRequest;
import com.example.online.music.service.UserSupportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userSupport")
public class UserSupportController {

    @Autowired
    UserSupportService userSupportService;

    @PostMapping("/test")
    public R isUserSupportComment(@RequestBody UserSupportRequest userSupportRequest) {
        return userSupportService.isUserSupportComment(userSupportRequest);
    }

    @PostMapping("/insert")
    public R insertCommentSupport(@RequestBody UserSupportRequest userSupportRequest) {
        return userSupportService.insertCommentSupport(userSupportRequest);
    }

    @PostMapping("/delete")
    public R deleteCommentSupport(@RequestBody UserSupportRequest userSupportRequest) {
        return userSupportService.deleteCommentSupport(userSupportRequest);
    }

    /**
     * @Description: 点赞
     * @Author: yang_yong
     * @CreateTime:
     * @param: userSupportRequest（commentId-评论id， userId-用户id）
     * @return: com.example.online.music.common.R
     **/
    @PostMapping("/like")
    public R toSupport(@RequestBody UserSupportRequest userSupportRequest) {
        return userSupportService.toSupport(userSupportRequest);
//        return R.success("点赞成功", 0);
    }
}
